/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package edu.fpt.stub;

import edu.fpt.entity.RentDetail;
import edu.fpt.session.RentDetailFacadeLocal;
import java.util.List;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.naming.Context;
import javax.naming.InitialContext;
import javax.naming.NamingException;

/**
 *
 * @author TuanAnh
 */
public class RentDetailStub {

    RentDetailFacadeLocal rent = lookupRentDetailFacadeLocal();

    public List<RentDetail> getAll() {
        return rent.findAll();
    }

    public void insertRent(RentDetail rentdetail) {
        rent.create(rentdetail);
    }
    public void delete(String customerId){
        RentDetail cus = rent.find(customerId);
        rent.remove(cus);
    }
    private RentDetailFacadeLocal lookupRentDetailFacadeLocal() {
        try {
            Context c = new InitialContext();
            return (RentDetailFacadeLocal) c.lookup("java:global/ProjectManagementHotel/ProjectManagementHotel-ejb/RentDetailFacade!edu.fpt.session.RentDetailFacadeLocal");
        } catch (NamingException ne) {
            Logger.getLogger(getClass().getName()).log(Level.SEVERE, "exception caught", ne);
            throw new RuntimeException(ne);
        }
    }
}
